package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Rendazonghepingjia;
import com.ruoyi.system.service.IRendazonghepingjiaService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 人大综合评价表Controller
 * 
 * @author Quilan
 * @date 2023-12-04
 */
@RestController
@RequestMapping("/system/rendazonghepingjia")
public class RendazonghepingjiaController extends BaseController
{
    @Autowired
    private IRendazonghepingjiaService rendazonghepingjiaService;

    /**
     * 查询人大综合评价表列表
     */
    @PreAuthorize("@ss.hasPermi('system:rendazonghepingjia:list')")
    @GetMapping("/list")
    public TableDataInfo list(Rendazonghepingjia rendazonghepingjia)
    {
        startPage();
        List<Rendazonghepingjia> list = rendazonghepingjiaService.selectRendazonghepingjiaList(rendazonghepingjia);
        return getDataTable(list);
    }

    /**
     * 导出人大综合评价表列表
     */
    @PreAuthorize("@ss.hasPermi('system:rendazonghepingjia:export')")
    @Log(title = "人大综合评价表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Rendazonghepingjia rendazonghepingjia)
    {
        List<Rendazonghepingjia> list = rendazonghepingjiaService.selectRendazonghepingjiaList(rendazonghepingjia);
        ExcelUtil<Rendazonghepingjia> util = new ExcelUtil<Rendazonghepingjia>(Rendazonghepingjia.class);
        util.exportExcel(response, list, "人大综合评价表数据");
    }

    /**
     * 获取人大综合评价表详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:rendazonghepingjia:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(rendazonghepingjiaService.selectRendazonghepingjiaById(id));
    }

    /**
     * 新增人大综合评价表
     */
    @PreAuthorize("@ss.hasPermi('system:rendazonghepingjia:add')")
    @Log(title = "人大综合评价表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Rendazonghepingjia rendazonghepingjia)
    {
        return toAjax(rendazonghepingjiaService.insertRendazonghepingjia(rendazonghepingjia));
    }

    /**
     * 修改人大综合评价表
     */
    @PreAuthorize("@ss.hasPermi('system:rendazonghepingjia:edit')")
    @Log(title = "人大综合评价表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Rendazonghepingjia rendazonghepingjia)
    {
        return toAjax(rendazonghepingjiaService.updateRendazonghepingjia(rendazonghepingjia));
    }

    /**
     * 删除人大综合评价表
     */
    @PreAuthorize("@ss.hasPermi('system:rendazonghepingjia:remove')")
    @Log(title = "人大综合评价表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(rendazonghepingjiaService.deleteRendazonghepingjiaByIds(ids));
    }
}
